﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JSIF_WCFServer.Misc.Logging
{
    /// <summary>
    /// Something which is capable of logging
    /// </summary>
    public interface ILogger
    {
        /// <summary>
        /// Logs a message
        /// </summary>
        /// <param name="level">The severity level of the message</param>
        /// <param name="cause">The (optional) cause of the message</param>
        /// <param name="msg">The message to be logged</param>
        void Log(ILogLevels level, Exception cause, String msg);
    }

    /// <summary>
    /// Something which is capable of logging from multiple sources simultaneously
    /// </summary>
    public interface IMultiPurposeLogger
    {
        /// <summary>
        /// Logs a message
        /// </summary>
        /// <param name="loggerName">The name of the logger that sent the message</param>
        /// <param name="level">The severity level of the message</param>
        /// <param name="cause">The (optional) cause of the message</param>
        /// <param name="msg">The message to be logged</param>
        void Log(String loggerName, ILogLevels level, Exception cause, String msg);
    }

    /// <summary>
    /// Basic levels of logging
    /// </summary>
    public enum ILogLevels
    {
        /// <summary>
        /// For developers only, should not be logged in production
        /// </summary>
        Debug,
        /// <summary>
        /// Information which is important to log but does not indicate any problems
        /// </summary>
        Info,
        /// <summary>
        /// Information which may indicate a potential problem
        /// </summary>
        Warn,
        /// <summary>
        /// A problem has occured but the system is able to continue running in some fashion
        /// </summary>
        Error,
        /// <summary>
        /// A serious problem has occured, the system cannot function normally and probably requires manual intervention
        /// </summary>
        Fatal
    }

    /// <summary>
    /// Constructs a logger
    /// </summary>
    public interface ILoggerFactory
    {
        /// <summary>
        /// Constrcuts a logger with the specified name
        /// </summary>
        /// <param name="name">the name of the logger to create</param>
        /// <returns>a logger with the specified name</returns>
        ILogger GetLogger(String name);
    }
}
